﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Microsoft.Xna.Framework.Content;
using DARE.Properties;

namespace DARE
{
    public class CDecalsBasicEffect: CBasicEffect
    {
        #region fields

       

        #endregion
                
        #region properties

        
        
        #endregion

        #region ctor

        /// <summary>
        /// Constructs the CBasicEffect class with a default effect file ("Shaders/IntensityEffect").
        /// If you want to use this ctor, you have to create this effect file at this path.
        /// You also have to implement a technique named "SpecularLight" which will be the default technique.
        /// If you don't want to, use the second ctor.
        /// </summary>
        /// <param name="content">The content manager you want to use for this effect</param>
        public CDecalsBasicEffect()
        {
            Name = "Shaders/DecalsBasicEffect";
#if WINDOWS_PHONE
            m_effect = new BasicEffect(DARE.CDare.Instance.GraphicsDevice);
#else
            m_effect = CResourceMgr.Load<Effect>(DARE.Properties.Resources.DecalsBasicEffect, Name);
            m_techniquePrefix = "Decals";
            Initialize(m_techniquePrefix + "VertexLightBasic");
#endif       
        }
        
        #endregion

        #region Method


        public override CBasicEffect ProcessEffect(CRender3D render, CEffect effect)
        {
            base.ProcessEffect(render, effect);

#if !WINDOWS_PHONE
            m_effect.Parameters["DecalsProjectorMatrix"].SetValue(effect.DecalsProjectorMatrix);
            m_effect.Parameters["DecalsMap"].SetValue(effect.DecalsMap);
#endif
            return this;
        }


        #endregion
    }
}
